

#import "LLFileLookView.h"
#import <QuickLook/QuickLook.h>


@interface LLFileLookView ()
<QLPreviewControllerDataSource, QLPreviewControllerDelegate>
@property (nonatomic, assign) BOOL hindNav;
@property (nonatomic, strong) QLPreviewController *previewController;


@end

@implementation LLFileLookView


#pragma mark - life cycle
- (void)awakeFromNib{
    [super awakeFromNib];

    self.previewController = [[QLPreviewController alloc] init];
    self.previewController.dataSource = self;
    self.previewController.delegate = self;
    [self addSubview:self.previewController.view];
}

-(void)layoutSubviews{
    self.previewController.view.frame = self.bounds;
    
}




#pragma mark - request methods

#pragma mark - QLPreviewControllerDataSource
// 显示的文件数量
- (NSInteger)numberOfPreviewItemsInPreviewController:(QLPreviewController *)controller{
    return 1;
}

- (id <QLPreviewItem>)previewController:(QLPreviewController *)controller previewItemAtIndex:(NSInteger)index{
//    NSURL *url = [NSURL fileURLWithPath:self.filePathArr[index]];
    return  self.filePath;
}

- (void)previewControllerDidDismiss:(QLPreviewController *)controller {
    //消失后做你想做的

}





#pragma mark - getters and setters

@end
